﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="actividadPupPop.aspx.cs" Inherits="GesWork.actividades.actividadPupPop" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       
    
                   <asp:FormView ID="FormView1" runat="server" CellPadding="4" DataKeyNames="ID" DataSourceID="dsActividades" 
            ForeColor="#333333"  
            Width="690px" AllowPaging="True"  >
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#b3b3b3"  /><EditRowStyle  BackColor="#b3b3b3"  ForeColor="White" />
            
           
            <ItemTemplate>
               
                 <div class="separador"></div> 
                 <br />
                 
                <img src="../images/activityType<%# Eval("ACC_Type") %>.png"  alt="<%# Eval("tipo") %>" title="<%# Eval("tipo") %>"/>
                <!-- <br />
                <b>ID:</b> -->
                
                <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>'  Visible="false"/>
                
                 <br />
                <b>Propietario:</b>
                <asp:Label ID="OwnerLabel" runat="server" Text='<%# Eval("IDOwner") %>' />
               <br /><br /> 
                 <div class="separador"></div> 
                 <br />
                
                <asp:Label ID="OwnerByTypeLabel" runat="server" Text='<%# Eval("OwnerByType") %>'  Visible="false" />
                
                <b>Relacionado con:</b>
                <asp:Label ID="IDToUserLabelContact" runat="server" 
                    Text='<%# Eval("Name")+" "+Eval("firstname")+" "+Eval("lastname") %>' Visible="false"/>
                <asp:Label ID="IDToUserLabelEnterprise" runat="server" Text='<%# Eval("enterpriseName") %>'  Visible="false"/>
                <asp:Label ID="IDToUserLabelOportunity" runat="server" Text='<%# Eval("oportunityName") %>' Visible="false"/>
                <br />
                <b>Asunto:</b>
                <asp:Label ID="SubjectLabel" runat="server" Text='<%# Eval("Subject") %>' />
                <br />
                <b>Mensaje:</b>
                <asp:Label ID="MSG_TextLabel" runat="server" Text='<%# Eval("MSG_Text") %>' />
                
                <br /><br /> 
                 <div class="separador"></div> 
                 <br />
                
                <b>Fecha de inicio:</b>
                <asp:Label ID="StartDateLabel" runat="server" Text='<%# Eval("StartDate", "{0:dd/MM/yyyy}") %>' />
                <br />
                <b>Fecha fin:</b>
                <asp:Label ID="DueDateLabel" runat="server" Text='<%# Eval("DueDate", "{0:dd/MM/yyyy}") %>' />
                <br />
              
                <b>Todo el dia:</b>
                <asp:CheckBox ID="AllDayEventCheckBox" runat="server" 
                    Checked='<%# Eval("AllDayEvent") %>' Enabled="false" />
               <br /><br /> 
                 <div class="separador"></div> 
                 
                 
                 <br />
                 
                <b>Estado:</b>
                <asp:Label ID="ACC_StateLabel" runat="server" Text='<%# Eval("estado") %>' />
                <br />
                <b>Prioridad:</b>
                <asp:Label ID="ACC_IDPriorityLabel" runat="server" 
                    Text='<%# Eval("prioridad") %>' />
                <br />
                <b>Categoria:</b>
                <asp:Label ID="ACC_CategoriesLabel" runat="server" 
                    Text='<%# Eval("ACC_Categories") %>' />
                
                <br /><br /> 
                 <div class="separador"></div> 
                 <br />
                
                
                 
               
                      
                       <b>Actividad Padre:</b> <asp:LinkButton ID="ACC_IDParentActivityLabel" runat="server" 
                            Text='<%# Eval("ACC_IDParentActivity") %>'  ForeColor="Black"  Font-Underline="true"  />
                           
                            
                
              
                <br /><br /> 
                 <div class="separador"></div> 
                 <br />
                 
        
         
       
         <asp:ImageButton ID="EditButton" runat="server"  ImageUrl="~/images/btnEditar.png"  CssClass="botones"  Text="Editar" onclick="EditButton_Click" />
        
         <asp:ImageButton ID="DeleteButton" runat="server"  ImageUrl="~/images/btnEliminar.png"  CssClass="botones"  Text="Eliminar" onclick="DeleteButton_Click" />
         
        
                    
            </ItemTemplate>
        </asp:FormView>
    
    <asp:SqlDataSource ID="dsActividades" runat="server" 
        ConnectionString="<%$ ConnectionStrings:gesworkConnectionString %>" 
        SelectCommand="SELECT TOP 1 Activity.ID, Activity.IDOwner,Activity.IDToUser,Oportunity.id as idoportunity,
                        Enterprise.ID as identerpise,Contact.id as idcontact,  Activity.OwneRByType, Contact.name,
                        Contact.firstname,Contact.lastname, Oportunity.Name AS oportunityName, Enterprise.Name As enterpriseName, Activity.Subject, 
                        Activity.MSG_Text, Activity.StartDate, Activity.DueDate, Activity.ACC_Type, ActivityType.Description AS tipo,
                         Activity.ACC_State, ActivityState.Description AS estado, Activity.ACC_IDPriority, ActivityPriority.Description AS prioridad ,
                        Activity.ACC_Categories, Activity.ACC_IDCampaign, Activity.ACC_IDParentActivity, Activity.FaxOrPhone, 
                        Activity.AllDayEvent, Activity.Layout, Activity.RecurrencePattern 

                        FROM Activity, Contact, Enterprise, Oportunity , ActivityType, ActivityPriority, ActivityState 

                        WHERE ((Enterprise.id= IDToUser AND  Activity.OwneRByType =1 ) or 
		                        (Contact.ID = IDToUser  AND  Activity.OwneRByType =2 ) OR 
		                        (Oportunity.id= IDToUser  AND  Activity.OwneRByType =0 )) 

                        AND (ActivityType.id=Activity.ACC_Type AND ActivityPriority.id=Activity.ACC_IDPriority 
                        AND ActivityState.id=Activity.ACC_State  AND Activity.ID=@ID)

					" 
            DeleteCommand="DELETE FROM [Activity] WHERE [ID] = @original_ID " 
           
            OldValuesParameterFormatString="original_{0}">
        <SelectParameters>
            <asp:QueryStringParameter Name="ID" QueryStringField="id" Type="Int32" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter Name="original_ID" Type="Int32" />
        </DeleteParameters>
        
    </asp:SqlDataSource>
    
    
    
    
    
    <br />
</p>
<p>
</p>
    
    
    
    </div>
    </form>
</body>
</html>
